package com.xyc.petmallsystem.repository;


import com.xyc.petmallsystem.pojo.Admin;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 * @author Joel
 * @date 2021/11/27
 */
public interface AdminRepository extends JpaRepository<Admin, Integer> {

    /*
    登录
     */
    @Query(value = "select * from admin where name = :name and password = :password", nativeQuery = true)
    Admin login(String name, String password);

    /*
    根据name查找
     */
    @Query(value = "select * from admin where name = :name", nativeQuery = true)
    Admin findByName(String name);
}
